home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 37
/
Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso
/
Aminet
/
dev
/
basic
/
Mildred.lha
/
lha
/
Remap.lha
/
SMR.ascii
< prev
next >
Wrap
Text File
|
1999-01-09
|
4KB
|
116 lines
#DTAG_DISP=$80000000
#DTAG_DIMS=$80001000
#DTAG_MNTR=$80002000
#DTAG_NAME=$80003000
NEWTYPE.SMode
DID.l
DWidth.l
DHeight.l
DDepth.w
DType.w
End NEWTYPE
DEFTYPE.Hook myhook ; The hook for ASL tag as &myhook
myhook\h_Entry=?hook
MOVE.l a5,globalbase
funcret.l=0
Dim SMRtags.TagItem(17)
SMRtags(0)\ti_Tag=#ASLSM_InitialLeftEdge,160 ; X coord of requester
SMRtags(1)\ti_Tag=#ASLSM_InitialTopEdge,0 ; Y coord of requester
SMRtags(2)\ti_Tag=#ASLSM_InitialWidth,300 ; Width of requester
SMRtags(3)\ti_Tag=#ASLSM_InitialHeight,400 ; Height of requester
SMRtags(4)\ti_Tag=#ASLSM_InitialDisplayID,$21000 ; Default ModeID (Pal:LowRes)
SMRtags(5)\ti_Tag=#ASLSM_InitialDisplayDepth,8 ; Default depth (8-bit usually)
SMRtags(6)\ti_Tag=#ASLSM_InitialDisplayWidth,PrefDisplayWidth
SMRtags(7)\ti_Tag=#ASLSM_InitialDisplayHeight,PrefDisplayHeight
SMRtags(8)\ti_Tag=#ASLSM_InitialOverscanType,1 ; Default overscan type (Text)
SMRtags(9)\ti_Tag=#ASLSM_InitialInfoOpened,1 ; Info window?
SMRtags(10)\ti_Tag=#ASLSM_InitialInfoLeftEdge,350 ; X coord of info window
SMRtags(11)\ti_Tag=#ASLSM_InitialInfoTopEdge,50 ; Y coord of info window
SMRtags(12)\ti_Tag=#ASLSM_DoDepth,0 ; Depth gadget? (Generally NO for chunky 8-bit)
SMRtags(13)\ti_Tag=#ASLSM_DoOverscanType,1 ; Overscan gadget?
SMRtags(14)\ti_Tag=#ASLSM_DoWidth,1 ; Width gadget?
SMRtags(15)\ti_Tag=#ASLSM_DoHeight,1 ; Height gadget?
SMRtags(16)\ti_Tag=#ASLSM_FilterFunc,&myhook ; Address of callback hook routine
SMRtags(17)\ti_Tag=#TAG_DONE,0
*sreq.SMode=0
*sreq=AllocAslRequest_(2,&SMRtags(0)\ti_Tag)
ok.b=AslRequest_(*sreq,&SMRtags(0)\ti_Tag)
If ok<>0
PrefDisplayID.l=*sreq\DID
PrefDisplayWidth.w=*sreq\DWidth
PrefDisplayHeight.w=*sreq\DHeight
EndIf
If (*sreq) Then FreeAslRequest_(*sreq)
Goto PrefsSkip
;*************************************************************************
; This is the statement that the hook will call. Put the label before
; the statement you want to jump to.
Runerrsoff
.hook_jump:
Statement hook{*dahook.Hook, modeID.l, *smr.ScreenModeRequester}
; We're inside the hook, and supposedly we should be able to do whatever
; we want.
; Filter modeID's here
SHARED funcret.l,SMRMinX,SMRMinY,SMRMaxX,SMRMaxY
DEFTYPE.DisplayInfo DisInfoBuf
DEFTYPE.DimensionInfo DimInfoBuf
DEFTYPE.MonitorInfo MonInfoBuf
DEFTYPE.NameInfo NamInfoBuf
;Refer to Includes/Graphics/DisplayInfo.h or view newtypes
IDhandle.l=FindDisplayInfo_(modeID)
GetDisplayInfoData_ IDhandle,&DisInfoBuf,SizeOf.DisplayInfo,#DTAG_DISP,0
GetDisplayInfoData_ IDhandle,&DimInfoBuf,SizeOf.DimensionInfo,#DTAG_DIMS,0
GetDisplayInfoData_ IDhandle,&MonInfoBuf,SizeOf.MonitorInfo,#DTAG_MNTR,0
GetDisplayInfoData_ IDhandle,&NamInfoBuf,SizeOf.NameInfo,#DTAG_NAME,0
;Do tests. True=Mode is valid, False=mode is invalid.
;See newtypes for DisplayInfo,DimensionInfo,MonitorInfo and NameInfo for things to further test
If DimInfoBuf\MaxDepth<>8
;No true-colour modes, only 8-bit
funcret=False
Else
funcret=True
EndIf
End Statement
;**********************
; Hook
Macro goto_hook
JSR `1+6
End Macro
globalbase: Dc.l 0
hook: ;This hook is called by the filter hook callback from screenmode requester, per item
; Store registers
MOVEM.l d1-d7/a0-a6,-(a7) ; Not d0!
; Put parameters into dregs ready for a statement
MOVE.l a0,d0
MOVE.l a1,d1
MOVE.l a2,d2
; Get global variable base
MOVE.l globalbase,a5
; Goto hook statement
!goto_hook{hook_jump}
GetReg d0,funcret ; return accept/discard
; Restore registers
MOVEM.l (a7)+,d1-d7/a0-a6 ; Not d0!
RTS
;**********************
Runerrson
PrefsSkip